/*
 * Copyright (c)
 * All rights reserved.
 * OrderFlowEntity.java
 */

package com.ueboot.weishop.entity.order;

import com.ueboot.weishop.entity.IDEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.Date;

/**
 * 描述: 订单附加扩展功能操作数据
 *
 * @author Yvan
 * @since 1.0
 */
@Data
@NoArgsConstructor
@Entity(name = "WS_ORDER_EXTENSION")
public class OrderExtensionEntity extends IDEntity {

    public static final String LOTTERY_UN = "未开奖";
    public static final String LOTTERY_NO = "未中奖";
    public static final String LOTTERY_YES = "中奖";

    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "WS_ORDER_EXTENSION")
    @GenericGenerator(name = "WS_ORDER_EXTENSION", strategy = "enhanced-table", parameters = {
            @org.hibernate.annotations.Parameter(name = "table_name", value = "WS_TABLE_SEQUENCE"),
            @org.hibernate.annotations.Parameter(name = "segment_value", value = "WS_ORDER_EXTENSION"),
            @org.hibernate.annotations.Parameter(name = "optimizer", value = "pooled")})
    @Column(name = "ID", columnDefinition = "INT(20) COMMENT 'id主键'", length = 20)
    private Long id;

    /**
     * 订单编号
     */
    @Column(name = "ORDER_NO", columnDefinition = "VARCHAR(40) COMMENT '订单编号'", length = 40)
    private String orderNo;

    /**
     * 所属分类代码
     */
    @Column(name = "CATEGORY_CODE", columnDefinition = "VARCHAR(40) COMMENT '所属分类代码'", length = 40)
    private String categoryCode;

    /**
     * 用户VIN码
     */
    @Column(name = "CUSTOMER_VIN", columnDefinition = "VARCHAR(40) COMMENT '用户VIN码'", length = 40)
    private String customerVin;
    /**
     * 车型
     */
    @Column(name = "CAR_TYPE", columnDefinition = "VARCHAR(200) COMMENT '车型'", length = 200)
    private String carType;

    /**
     * 目标经销商
     */
    @Column(name = "TARGET_DEALER", columnDefinition = "VARCHAR(200) COMMENT '目标经销商'", length = 200)
    private String targetDealer;

    /**
     * 目标经销商代码
     */
    @Column(name = "TARGET_DEALER_CODE", columnDefinition = "VARCHAR(200) COMMENT '目标经销商代码'", length = 200)
    private String targetDealerCode;

    /**
     * 申请退款：发送Dms时间
     */
    @Column(name = "REFUND_SEND_DMS_TIME", columnDefinition = "DATE COMMENT '申请退款：发送Dms时间'")
    private Date refundSendDmsTime;

    /**
     * 发送DMS状态：待发送；已发送
     *
     * @see OrderEnum
     */
    @Column(name = "SEND_DMS_STATUS", columnDefinition = "VARCHAR(15) COMMENT '发送DMS状态：待发送；已发送'", length = 15)
    private String sendDmsStatus = OrderEnum.SEND_STATUS_0;

    /**
     * 发送DMS的次数，超过3次就不做查询发送
     */
    @Column(name = "SEND_DMS_COUNT", columnDefinition = "INT(1) COMMENT '发送DMS的次数，超过3次就不做查询发送'", length = 1)
    private Integer sendDmsCount;

    /**
     * 发送DMS的响应结果。
     */
    @Column(name = "DMS_RESULT", columnDefinition = "VARCHAR(200) COMMENT '发送DMS的响应结果。'", length = 200)
    private String dmsResult;

    /**
     * 发送历史记录
     */
    @Column(name = "SEND_DMS_HISTORY", columnDefinition = "VARCHAR(2000) COMMENT '发送历史记录'", length = 2000)
    private String sendDmsHistory;

    /**
     * 发送操作：2 主动取消
     */
    @Column(name = "CANCEL", columnDefinition = "VARCHAR(1) COMMENT '发送操作：0 新增，1 自动取消，2 主动取消'", length = 1)
    private String cancel;

    /**
     * 发送短信状态：待发送；发送中；已发送
     *
     * @see OrderEnum
     */
    @Column(name = "SEND_SMS_STATUS", columnDefinition = "VARCHAR(15) COMMENT '发送短信状态：待发送；发送中；已发送'", length = 15)
    private String sendSmsStatus;

    /**
     * 发送微信推送时间
     */
    @Column(name = "SEND_SMS_TIME", columnDefinition = "Date COMMENT '发送微信对送时间'")
    private Date sendSmsTime;

    /*-----------------众筹相关------------------*/

    /**
     * 购买的中奖号码列表 多个以,号分割：例如012013,123142,321412
     */
    @Column(name = "LOTTERY_NUMS", columnDefinition = "VARCHAR(1500) COMMENT '购买的中奖号码列表 多个以,号分割：例如012013,123142,321412'", length = 1500)
    private String lotteryNums;

    /**
     * 中奖号码
     */
    @Column(name = "LOTTERY_NUM", columnDefinition = "VARCHAR(20) COMMENT '中奖号码'", length = 20)
    private String lotteryNum;

    /**
     * 所属期次号
     */
    @Column(name = "PERIOD_NUM", columnDefinition = "VARCHAR(50) COMMENT '所属期次号'", length = 50)
    private String periodNum;

    /**
     * 产品名称
     */
    @Column(name = "GOODS_NAME", columnDefinition = "VARCHAR(500) COMMENT '产品名称'", length = 500)
    private String goodsName;

    /**
     * 中奖结果，未开奖，中奖，未中奖
     */
    @Column(name = "LOTTERY", columnDefinition = "VARCHAR(20) COMMENT '中奖结果，未开奖，中奖，未中奖'", length = 20)
    private String lottery = LOTTERY_UN;

    /**
     * 客户微信唯一标识
     */
    @Column(name = "CUSTOMER_OPEN_ID", columnDefinition = "VARCHAR(50) COMMENT '客户微信唯一标识'", length = 50)
    private String customerOpenId;
}